#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BUFFER_SIZE 1024
#define CHUNK_SIZE 16

void read_and_process_file(const char *filename) {
    FILE *file = fopen(filename, "r");
    if (file == NULL) {
        perror("Error opening file");
        exit(EXIT_FAILURE);
    }

    char buffer[BUFFER_SIZE];
    long long numbers[CHUNK_SIZE];
    int count = 0;

    while (fgets(buffer, sizeof(buffer), file)) {
     long long *token = strtok(buffer, " \t\n");
        while (token != NULL) {
            if (count < CHUNK_SIZE) {
                numbers[count++] = atoi(token);
            } else {
                // Process the chunk of 16 numbers
                for (int i = 0; i < CHUNK_SIZE; i++) {
                    printf("%d ", numbers[i]);
                }
                printf("\n");
                count = 0; // Reset count for next chunk
            }
            token = strtok(NULL, " \t\n");
        }
    }

    // Process any remaining numbers in the last chunk
    if (count > 0) {
        for (int i = 0; i < count; i++) {
            printf("%d ", numbers[i]);
        }
        printf("\n");
        printf("(%d)",count);
        printf("%d\n",numbers[1]);
        printf("%lld",atoi(1111111111111111));
    }

    fclose(file);
}

int main() {
    const char *filename = "test.txt";
    read_and_process_file(filename);
    return 0;
}
